package org.yagnus.stats.summary.univariate;

public class Min<O extends Comparable<O>> extends
		UnivariateWeightedSummaryStatistic<O> {

	O min = null;

	@Override
	public O get() {
		if (min == null)
			return null;
		else
			return min;
	}

	@Override
	public void clear() {
		min = null;
	}

	@Override
	public void add(O data, double weight) {
		if (min == null) {
			min = data;
		} else if (data != null) {
			if (min.compareTo(data) > 0) {
				min = data;
			}
		}

	}

}
